<?php
    include_once '../../../../controlador/php/conexion/Conexion.php';
    $con = new Conexion();
    
    $ingresos = $_REQUEST['ingre'];
    $conduc =  $_REQUEST['conduc'];
    
    $consul = "select top 1 DATEDIFF(HOUR,ate_fecha,GETDATE())as horas,ate_conducta
              from atenMaterna 
              where adnIngreso = ".$ingresos."
              order by ate_oid desc";
    $campos = $con->query($consul);
    
    while($respu = mssql_fetch_array($campos)){
        $horas = $respu['horas'];
        $conducta = $respu['ate_conducta'];
    }
    
    if($horas == ""){
        $horas2 = "1";
    }else{
        $horas2 = $horas;
    }
       
    if($horas2 > "24"){
            print_r(json_encode(array('respuesta'=>'no')));
        }else if($horas < "24" && $conducta != $conduc){
            print_r(json_encode(array('respuesta'=>'si')));
        }else if($horas < "24" && $conducta == $conduc){
            print_r(json_encode(array('respuesta'=>'hg')));
        }else if($horas == "1"){
            print_r(json_encode(array('respuesta'=>'si')));
        }
    $con->cerrarConexion();
?>
